package com.kr.aia.powerrp.setting;
 
import java.util.ArrayList;
import java.util.HashMap;

import com.kr.aia.powerrp.R;
 
import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
 
public class ContactListAdapter extends BaseAdapter {
 
    private Activity activity;
    private ArrayList<ContactInfo> data;
    private static LayoutInflater inflater=null;
    //public ImageLoader imageLoader;
 
    public ContactListAdapter(Activity a, ArrayList<ContactInfo> d) {
        activity = a;
        data=d;
        inflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        //imageLoader=new ImageLoader(activity.getApplicationContext());
    }
 
    public int getCount() {
        return data.size();
    }
    
    public ContactInfo getItem(int position) {
        return data.get(position);
    }
 
    public long getItemId(int position) {
        return position;
    }
 
    public View getView(int position, View convertView, ViewGroup parent) {
        View vi=convertView;
        if(convertView==null){
            vi = inflater.inflate(R.layout.setting_contact_list_popup_row, null);
        }
        
        TextView contact_name = (TextView)vi.findViewById(R.id.contact_name); // title
        TextView contact_phoneno = (TextView)vi.findViewById(R.id.contact_phoneno); // artist name
 
        ContactInfo persons = data.get(position);
 
        // Setting all values in listview
        contact_name.setText(persons.getContactName());
        contact_phoneno.setText(persons.getContactPhoneNo());
        //duration.setText(song.get(CustomizedListView.KEY_DURATION));
        //imageLoader.DisplayImage(song.get(CustomizedListView.KEY_THUMB_URL), thumb_image);
        return vi;
    }
}